import { KKSpriteAnimeCollectionInfo } from '@coldcloude/kakera';
import { _decorator, Component, JsonAsset, SpriteAtlas } from 'cc';
import { KKAnimeHub } from './Animator';
const { ccclass, property } = _decorator;

@ccclass('SpriteAnimeResource')
export class SpriteAnimeResource extends Component {

    //config

    @property(JsonAsset)
    aniColleJson:JsonAsset;

    @property(SpriteAtlas)
    atlas:SpriteAtlas;

    //runtime

    initialized = false;
    
    hub:KKAnimeHub;

    init(){
        if(!this.initialized){
            this.initialized = true;
            const aniColle = this.aniColleJson.json as KKSpriteAnimeCollectionInfo;
            this.hub = new KKAnimeHub(aniColle);
        }
    }
}
